package yawning.mew.cat;

import yawning.mew.BuffsDebuffs.Buff;
import yawning.mew.sim.SimulationAction;
import yawning.mew.sim.SimulationEventAction;

public class EventUnholyFrenzy extends SimulationEventAction {
	CatModelSimState mState;
	double mCooldownAt;
	
	EventUnholyFrenzy(CatModelSimState state) {
		super(state.mSimUtil);
		mState = state;
	}

	@Override
	public double perform() {
		if (mCooldownAt <= mState.mSimUtil.getSimTime() && mState.mModel.buffsDebuffs.isBuff(Buff.UNHOLYFRENZY)) {
			schedule(mState.mModel.unholyFrenzyBuffDuration);
			mState.mModel.meleeHasteMult *= 1.2;
			mCooldownAt = mState.mSimUtil.getSimTime() + mState.mModel.unholyFrenzyCDDuration;
			return 0.0;
		}
		return SimulationAction.ACTION_FAIL;
	}

	@Override
	public void onExpire() {
		mState.mModel.meleeHasteMult /= 1.2;
	}
}